﻿<div class="form-horizontal" ms-controller="LCSPADD">
    <div class="form-group">
        <label class="col-xs-2 control-label">表单申请人</label>
        <div class="col-xs-4">
            <p class="form-control-static" ms-text="modelData.ShenQingRen"></p>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label"><span class="Required">*</span>流程类别</label>
        <div class="col-xs-5">
            <select name="conType" id="conType" ms-duplex="modelData.LeiBie" class="form-control">
                <option ms-repeat-item="ColumnData" ms-attr-value="item.TypeNO" ms-attr-selected="item.TypeNO==modelData.LeiBie?'selected':''">{{item.TypeNO}}</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">申请内容</label>
        <div class="col-xs-9">
            <textarea type="text" ms-duplex="modelData.Content" rows="5" class="span2   form-control"></textarea>
        </div>
    </div>
</div>
<script>
    var strId = ComFunJS.getQueryString("ID");
    var model = avalon.define({
        $id: "LCSPADD",
        ColumnData: [],
        SPUserData: [],
        modelData: { "ShenQingRen": ComFunJS.convertuser(ComFunJS.getCookie('username')), "LeiBie": "", "Content": ""}
    });
    function getdata() {
        var modelValue = JSON.stringify(model.modelData.$model);
        return { Action: "ADDLCSP", P1: modelValue };
    }
    function getSPdata(reason, status) {
        return { Action: "SPLCSP", P1: strId, P2: reason, spstatus: status };
    }
    avalon.ready(function () {
        //获取请假类型
        $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1:10 }, function (resultData) {
            if (resultData.ErrorMsg == "") {
                model.ColumnData = resultData.Result;
                if (strId == null) {
                    model.modelData.LeiBie = resultData.Result[0].TypeNO;
                }
            }
        })
      
        if (strId != null) {
            //编辑加载数据
            $.getJSON('/API/FTAPI.ashx?Action=GETLCSPMODEL', { P1: strId }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    model.modelData = resultData.Result;
                }
            })
        }
    })
    $(function () {
        if (strId == null) {
            $(".btnSucc").text("送审");
        }
    })
</script>
